<?php

namespace Agp\CoreBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * Agp\CoreBundle\Entity\Atendente
 *
 * @ORM\Table(name="terminal_empresa_config")
 * @ORM\Entity(repositoryClass="Agp\CoreBundle\Repository\TerminalEmpresaConfigRepository")
 * @ORM\HasLifecycleCallbacks
 */
class TerminalEmpresaConfig
{
    /**
     * @var integer $codAtendente
     *
     * @ORM\Column(name="cod_terminal_empresa_config", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    protected $codTerminalEmpresaConfig;

    /**
     * @var object $terminalEmpresa
     *
     * @ORM\ManyToOne(targetEntity="TerminalEmpresa", fetch="LAZY", inversedBy="configs")
     * @ORM\JoinColumn(name="cod_terminal_empresa", referencedColumnName="cod_terminal_empresa", onDelete="Cascade", nullable=false)
     */
    protected $terminalEmpresa;
    
    /**
     * @var object $atendente
     *
     * @ORM\ManyToOne(targetEntity="Atendente", fetch="LAZY")
     * @ORM\JoinColumn(name="cod_atendente", referencedColumnName="cod_atendente", onDelete="Cascade", nullable=true)
     * @Assert\NotBlank()
     */
    protected $atendente;
    
    /**
     * @var object $layout
     *
     * @ORM\ManyToOne(targetEntity="Layout", fetch="LAZY")
     * @ORM\JoinColumn(name="cod_layout", referencedColumnName="cod_layout", onDelete="Cascade", nullable=true)
     */
    protected $layout;
    
    /**
     * @var object $evento
     *
     * @ORM\ManyToOne(targetEntity="Evento", fetch="LAZY")
     * @ORM\JoinColumn(name="cod_evento", referencedColumnName="cod_evento", onDelete="Cascade", nullable=true)
     */
    protected $evento;
    
    
    // PADRAO - CONFIGURAÇÃO CRIADA AO CADASTRAR O TERMINAL EMPRESA
    // EVENTO - CONFIGURAÇÃO DA PARA DO EVENTO
    /**
     * @ORM\Column(name="tipo", type="string", length=45, nullable=false)
     * @var type string
     */
    protected $tipo;
    const TP_PAD = "Padrão";
    const TP_EVE = "Evento";

    public function getCodTerminalEmpresaConfig() {
        return $this->codTerminalEmpresaConfig;
    }

    public function setCodTerminalEmpresaConfig($codTerminalEmpresaConfig) {
        $this->codTerminalEmpresaConfig = $codTerminalEmpresaConfig;
    }

    public function getTerminalEmpresa() {
        return $this->terminalEmpresa;
    }

    public function setTerminalEmpresa($terminalEmpresa) {
        $this->terminalEmpresa = $terminalEmpresa;
    }

    public function getAtendente() {
        return $this->atendente;
    }

    public function setAtendente($atendente) {
        $this->atendente = $atendente;
    }

    public function getLayout() {
        return $this->layout;
    }

    public function setLayout($layout) {
        $this->layout = $layout;
    }

    public function getEvento() {
        return $this->evento;
    }

    public function setEvento($evento) {
        $this->evento = $evento;
    }
    
    public function getTipo() {
        return $this->tipo;
    }

    public function setTipo($tipo) {
        $this->tipo = $tipo;
    }

    public function isPadrao(){
        return ($this->tipo == self::TP_PAD);

    }
}